﻿<Grid x:Name="userControl" x:Class="Daytimer.Controls.SplitHighlightPicker"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
		xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DesignHeight="23"
		d:DesignWidth="34" IsEnabledChanged="userControl_IsEnabledChanged">
	<Grid.Resources>
		<Style TargetType="RadioButton">
			<Setter Property="Margin" Value="2" />
			<Setter Property="BorderThickness" Value="1" />
			<Setter Property="BorderBrush" Value="#FFE2E4E7" />
			<Setter Property="Width" Value="26" />
			<Setter Property="Height" Value="26" />
			<Setter Property="HorizontalAlignment" Value="Center" />
			<Setter Property="VerticalAlignment" Value="Center" />
			<Setter Property="GroupName" Value="SplitHighlightPickerRadio" />
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="RadioButton">
						<Border x:Name="radioButtonBorder" BorderBrush="{TemplateBinding BorderBrush}"
								BorderThickness="{TemplateBinding BorderThickness}"
								Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
							<Border x:Name="innerBorder" BorderThickness="1" BorderBrush="Transparent"
									SnapsToDevicePixels="True" IsHitTestVisible="False" />
						</Border>
						<ControlTemplate.Triggers>
							<Trigger Property="IsMouseOver" Value="True">
								<Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="#FFF29436" />
								<Setter Property="BorderBrush" TargetName="innerBorder" Value="#FFFFE294" />
								<Setter Property="BorderThickness" TargetName="radioButtonBorder" Value="1" />
							</Trigger>
							<Trigger Property="IsChecked" Value="True">
								<Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="#FFEF4810" />
								<Setter Property="BorderBrush" TargetName="innerBorder" Value="#FFFFE294" />
								<Setter Property="BorderThickness" TargetName="radioButtonBorder" Value="1" />
							</Trigger>
							<Trigger Property="IsEnabled" Value="False">
								<Setter Property="Opacity" TargetName="radioButtonBorder" Value="0.5" />
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
			<EventSetter Event="Click" Handler="Color_Click" />
		</Style>
		<Style x:Key="ButtonSimulation" TargetType="RadioButton">
			<Setter Property="Width" Value="Auto" />
			<Setter Property="Height" Value="24" />
			<Setter Property="HorizontalAlignment" Value="Stretch" />
			<Setter Property="VerticalAlignment" Value="Stretch" />
			<Setter Property="GroupName" Value="SplitHighlightPickerRadio" />
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="RadioButton">
						<Grid x:Name="grid" Background="Transparent">
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="30" />
								<ColumnDefinition />
							</Grid.ColumnDefinitions>
							<Border x:Name="radioButtonBorder" BorderBrush="Transparent" BorderThickness="1"
									SnapsToDevicePixels="True" Width="20" Height="20" Margin="2,0"
									HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
								<Border x:Name="middleBorder" SnapsToDevicePixels="True" BorderThickness="1"
										BorderBrush="Transparent" Background="Transparent">
									<Border x:Name="innerBorder" BorderThickness="1" BorderBrush="#FFE2E4E7"
											SnapsToDevicePixels="True" Background="{TemplateBinding Background}" />
								</Border>
							</Border>
							<ContentPresenter Content="{TemplateBinding Content}" HorizontalAlignment="Left"
									VerticalAlignment="Center" Grid.Column="1" RecognizesAccessKey="True" />
						</Grid>
						<ControlTemplate.Triggers>
							<Trigger Property="IsMouseOver" Value="True">
								<Setter Property="Background" TargetName="grid"
										Value="{DynamicResource ButtonMouseOverBackground}" />
							</Trigger>
							<Trigger Property="IsChecked" Value="True">
								<Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="#FF92C0E0" />
								<Setter Property="BorderBrush" TargetName="middleBorder" Value="#FFE6F2FA" />
								<Setter Property="Background" TargetName="middleBorder" Value="#FFE6F2FA" />
							</Trigger>
							<Trigger Property="IsEnabled" Value="False">
								<Setter Property="Opacity" TargetName="radioButtonBorder" Value="0.5" />
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
			<EventSetter Event="Click" Handler="Color_Click" />
		</Style>
	</Grid.Resources>
	<Grid.ColumnDefinitions>
		<ColumnDefinition Width="*" />
		<ColumnDefinition Width="Auto" />
	</Grid.ColumnDefinitions>
	<Border x:Name="PART_Overlay" Grid.ColumnSpan="2" BorderThickness="1" BorderBrush="Transparent" />
	<Button x:Name="PART_Button" Width="NaN" Height="NaN" MinWidth="0" Focusable="False" Click="PART_Button_Click">
		<Button.Template>
			<ControlTemplate TargetType="{x:Type Button}">
				<Border x:Name="PART_Border" Background="Transparent">
					<Grid HorizontalAlignment="Center" VerticalAlignment="Center" IsHitTestVisible="False">
						<Grid.RowDefinitions>
							<RowDefinition Height="*" />
							<RowDefinition Height="Auto" />
						</Grid.RowDefinitions>
						<Image x:Name="PART_Image" Stretch="None" HorizontalAlignment="Center"
								VerticalAlignment="Bottom" Source="{Binding ButtonImage, ElementName=userControl}" />
						<Border x:Name="PART_Selected" Width="16" Height="4" HorizontalAlignment="Center" Grid.Row="1"
								Background="{Binding SelectedColor, ElementName=userControl}" />
					</Grid>
				</Border>
				<ControlTemplate.Triggers>
					<Trigger Property="IsMouseOver" Value="True">
						<Setter Property="Background" TargetName="PART_Border" Value="{DynamicResource RibbonMouseOver}" />
					</Trigger>
					<Trigger Property="IsPressed" Value="True">
						<Setter Property="Background" TargetName="PART_Border" Value="{DynamicResource RibbonPressed}" />
					</Trigger>
				</ControlTemplate.Triggers>
			</ControlTemplate>
		</Button.Template>
	</Button>
	<ToggleButton x:Name="PART_ToggleButton" Grid.Column="1" Width="13" Focusable="False"
			IsChecked="{Binding IsChecked, ElementName=userControl}" ClickMode="Press">
		<ToggleButton.Template>
			<ControlTemplate TargetType="{x:Type ToggleButton}">
				<Border x:Name="PART_Border" Background="Transparent">
					<Path x:Name="Arrow"
							Data="F1M0,0L2.667,2.66665 5.3334,0 5.3334,-1.78168 2.6667,0.88501 0,-1.78168 0,0z"
							Fill="#FF606060" HorizontalAlignment="Center" Margin="0,2,0,0" VerticalAlignment="Center"
							IsHitTestVisible="False" />
				</Border>
				<ControlTemplate.Triggers>
					<Trigger Property="IsMouseOver" Value="True">
						<Setter Property="Background" TargetName="PART_Border" Value="{DynamicResource RibbonMouseOver}" />
					</Trigger>
					<Trigger Property="IsChecked" Value="True">
						<Setter Property="Background" TargetName="PART_Border" Value="{DynamicResource RibbonChecked}" />
					</Trigger>
					<Trigger Property="IsPressed" Value="True">
						<Setter Property="Background" TargetName="PART_Border" Value="{DynamicResource RibbonPressed}" />
					</Trigger>
				</ControlTemplate.Triggers>
			</ControlTemplate>
		</ToggleButton.Template>
	</ToggleButton>
	<Popup x:Name="PART_Popup" IsOpen="{Binding IsChecked, ElementName=userControl}" HorizontalOffset="-5"
			VerticalOffset="-6" PopupAnimation="Fade" AllowsTransparency="True" SnapsToDevicePixels="True"
			StaysOpen="False">
		<Popup.Style>
			<Style TargetType="Popup">
				<Style.Triggers>
					<Trigger Property="IsOpen" Value="True">
						<Trigger.EnterActions>
							<BeginStoryboard>
								<Storyboard>
									<DoubleAnimation Storyboard.TargetProperty="VerticalOffset" From="-30" To="-6"
											Duration="0:0:0.4">
										<DoubleAnimation.EasingFunction>
											<QuarticEase />
										</DoubleAnimation.EasingFunction>
									</DoubleAnimation>
								</Storyboard>
							</BeginStoryboard>
						</Trigger.EnterActions>
					</Trigger>
				</Style.Triggers>
			</Style>
		</Popup.Style>
		<Border x:Name="OuterBorder">
			<Border.CacheMode>
				<BitmapCache />
			</Border.CacheMode>
			<Border.Effect>
				<DropShadowEffect Color="#FFBBBBBB" ShadowDepth="0" RenderingBias="Performance" Opacity="0.5" />
			</Border.Effect>
			<Border x:Name="InnerBorder" BorderBrush="#FFC6C6C6" BorderThickness="1"
					Background="{DynamicResource White}" Margin="5">
				<Border x:Name="ItemsPresenter" Margin="1">
					<Grid Width="150">
						<Grid.RowDefinitions>
							<RowDefinition Height="Auto" />
							<RowDefinition Height="Auto" />
						</Grid.RowDefinitions>
						<Grid x:Name="themeColorsBody" Height="90">
							<Grid.ColumnDefinitions>
								<ColumnDefinition />
								<ColumnDefinition />
								<ColumnDefinition />
								<ColumnDefinition />
								<ColumnDefinition />
							</Grid.ColumnDefinitions>
							<Grid.RowDefinitions>
								<RowDefinition />
								<RowDefinition />
								<RowDefinition />
							</Grid.RowDefinitions>
							<RadioButton Background="#FFFFFF00" />
							<RadioButton Background="#FF00FF00" Grid.Column="1" />
							<RadioButton Background="#FF00FFFF" Grid.Column="2" />
							<RadioButton Background="#FFFF00FF" Grid.Column="3" />
							<RadioButton Background="#FF0000FF" Grid.Column="4" />
							<RadioButton Background="#FFFF0000" Grid.Row="1" />
							<RadioButton Background="#FF000080" Grid.Row="1" Grid.Column="1" />
							<RadioButton Background="#FF008080" Grid.Row="1" Grid.Column="2" />
							<RadioButton Background="#FF008000" Grid.Row="1" Grid.Column="3" />
							<RadioButton Background="#FF800080" Grid.Row="1" Grid.Column="4" />
							<RadioButton Background="#FF800000" Grid.Row="2" />
							<RadioButton Background="#FF808000" Grid.Row="2" Grid.Column="1" />
							<RadioButton Background="#FF808080" Grid.Row="2" Grid.Column="2" />
							<RadioButton Background="#FFC0C0C0" Grid.Row="2" Grid.Column="3" />
							<RadioButton Background="#FF000000" Grid.Row="2" Grid.Column="4" />
						</Grid>
						<RadioButton x:Name="noColorButton" Grid.Row="1" Style="{StaticResource ButtonSimulation}"
								Background="{x:Null}" Content="_No Color" Height="24" Width="150" />
					</Grid>
				</Border>
			</Border>
		</Border>
	</Popup>
</Grid>
	